home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Frameworks / TransSkel 3.24 / Source / SkelGetWindDevice.c < prev    next >
Text File  |  1996-01-17  |  2KB  |  52 lines

  1. /*
  2.  * Get the device containing most of a window's content rectangle and the
  3.  * largest usable rectangle on that device.  If the device is the main
  4.  * device, the rectangle is adjusted not to contain the menu bar area.
  5.  *
  6.  * The result is used by TransSkel for window zooming.  Normally, the
  7.  * caller adjusts the top of the rectangle to account for the title bar
  8.  * height, then insets it by a few pixels in order to leave a little
  9.  * space around the window edges.  SkelGetWindowDevice() itself does
  10.  * not account for the title bar height.  That responsibility is
  11.  * left with the caller, which can call SkelGetWindTitleHeight() to
  12.  * find this out.
  13.  *
  14.  * Returns true if the window overlaps some device in its current
  15.  * position.  False can be returned, for instance, if an application
  16.  * saves document window positions and a document is saved while
  17.  * positioned on a second monitor, then opened on a system that doesn't
  18.  * have a second monitor.
  19.  *
  20.  * The returned device value will be nil on systems that don't have GDevices
  21.  * (i.e.,, that don't support Color QuickDraw), even if the function result
  22.  * is true.
  23.  *
  24.  * If the window does not overlap any device, the device and devRect arguments
  25.  * are filled in with the values for the main device.  The rectangle can
  26.  * be used to position the window so it can be made visible.
  27.  *
  28.  * If the caller is not interested in the device or rectangle, nil
  29.  * can be passed instead of the address of a variable.
  30.  *
  31.  * References: TN TB 30, HIN 6, HIN 7.
  32.  */
  33.  
  34. # include    "TransSkel.h"
  35.  
  36.  
  37. pascal Boolean
  38. SkelGetWindowDevice (WindowPtr wind, GDHandle *gd, Rect *devRect)
  39. {
  40. Rect    r;
  41. Boolean    isMain;
  42. Boolean    result;
  43.  
  44.     /* get window content rect in global coordinates */
  45.  
  46.     SkelGetWindContentRect (wind, &r);
  47.     result = SkelGetRectDevice (&r, gd, devRect, &isMain);
  48.     if (isMain && devRect != (Rect *) nil)
  49.         devRect->top += SkelQuery (skelQMBarHeight);
  50.     return (result);
  51. }
  52.